﻿using System;
using System.Collections.Generic;
using System.Text;
using NLBS.Entity;
using NLBS.Framework;
namespace NLBS.Data.Business
{
    public interface IPageCache<T>
    {
        /// <summary>
        /// 获取和设置列表主键
        /// </summary>
        IList<int> KeyList{ get;set;}

        string CacheKey { get; }

        IPagedCollection<T> PageList { get; set; }

        /// <summary>
        /// start end
        /// </summary>
        PageSetting Setting { get; set; }

        /// <summary>
        /// 初始化键值
        /// </summary>
        void InitListLength();

        /// <summary>
        /// 更新键值
        /// </summary>
        void AddCacheKey();
        /// <summary>
        /// 添加实体
        /// </summary>
        void AddCacheEntity();
    }

    public class PageSetting
    {

        public PageSetting(int start, int end)
        {
            this.Start = start;
            this.End = end;
        }
        public PageSetting(int start, int end, string key)
        {
            this.Start = start;
            this.End = end;
            this.Replicekey = key;
        }
        private int _start;

        public int Start
        {
            get { return _start; }
            set { _start = value; }
        }

        private int _end;

        public int End
        {
            get { return _end; }
            set { _end = value; }
        }

        private string _replicekey;

        public string Replicekey
        {
            get { return _replicekey; }
            set { _replicekey = value; }
        }
    }
}